-
Notifications
You must be signed in to change notification settings - Fork 4.8k
fix(source-google-ads): prevent StreamSlice mutation to fix cursor validation error #67591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
fix(source-google-ads): prevent StreamSlice mutation to fix cursor validation error #67591
Conversation
…lidation error - Copy cursor_slice dict before modifying in ChangeStatusRetriever to avoid mutating original StreamSlice - Add associated_slice to deleted Record objects in CriterionRetriever to ensure proper cursor tracking - Fixes #9633: Invalid state as stream slices that are emitted should refer to an existing cursor Co-Authored-By: unknown <>
Original prompt from API User
|
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
👋 Greetings, Airbyte Team Member!Here are some helpful tips and reminders for your convenience. Helpful Resources
PR Slash CommandsAirbyte Maintainers (that's you!) can execute the following slash commands on your PR:
|
|
/bump-version |
Co-Authored-By: unknown <>
Deploy preview for airbyte-docs ready! ✅ Preview Built with commit 6ccbd79. |
What
Fixes issue #9633 where Google Ads connector syncs fail with "Invalid state as stream slices that are emitted should refer to an existing cursor" error.
The root cause was that
ChangeStatusRetriever
andCriterionRetriever
were mutatingStreamSlice
objects during record processing, which breaks theConcurrentPerPartitionCursor
tracking mechanism.How
ChangeStatusRetriever fix: Changed
cursor_slice = stream_slice.cursor_slice
tocursor_slice = dict(stream_slice.cursor_slice)
to create a copy before modifying it, preventing mutation of the original StreamSlice object.CriterionRetriever fix: Added
associated_slice=stream_slice
parameter to deleted Record objects to ensure proper cursor tracking.The cursor validation fails because
ConcurrentPerPartitionCursor
usesStreamSlice
objects as dictionary keys, and their hash/equality depends on thecursor_slice
contents. Mutating the cursor_slice in place changes the hash, making the slice unfindable in the cursor's internal tracking.Review guide
airbyte-integrations/connectors/source-google-ads/source_google_ads/components.py
- Focus on lines 449 and 534:cursor_slice
dict prevents the original StreamSlice mutationassociated_slice
to deleted records doesn't break existing logicUser Impact
Positive: Fixes Google Ads connector syncs that were failing with cursor validation errors, particularly affecting the
campaign_criterion
stream.Potential risks:
Can this PR be safely reverted and rolled back?
The changes are minimal and localized to specific error handling paths. Reverting would simply restore the previous (broken) behavior.
Link to Devin run: https://app.devin.ai/sessions/1b6c7df5a82a49e58e813bff4dcfce13
Requested by: agarctfi